﻿namespace NEvoWeb.Modules.NB_Store
{
    using DotNetNuke.Common;
    using DotNetNuke.Entities.Modules;
    using DotNetNuke.Services.Exceptions;
    using DotNetNuke.Services.Localization;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Runtime.CompilerServices;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class AdminProduct : BaseAdminModule
    {
        protected int _CatID;
        [AccessedThroughProperty("cblCategories")]
        private CheckBoxList _cblCategories;
        [AccessedThroughProperty("cmdAddCat")]
        private LinkButton _cmdAddCat;
        [AccessedThroughProperty("cmdAddModel")]
        private LinkButton _cmdAddModel;
        [AccessedThroughProperty("cmdAddOption")]
        private LinkButton _cmdAddOption;
        [AccessedThroughProperty("cmdAddOptionValue")]
        private LinkButton _cmdAddOptionValue;
        [AccessedThroughProperty("cmdAddSelected")]
        private LinkButton _cmdAddSelected;
        [AccessedThroughProperty("cmdCancel")]
        private LinkButton _cmdCancel;
        [AccessedThroughProperty("cmdClearSelected")]
        private LinkButton _cmdClearSelected;
        [AccessedThroughProperty("cmdSelectRelated")]
        private LinkButton _cmdSelectRelated;
        [AccessedThroughProperty("cmdUpdate")]
        private LinkButton _cmdUpdate;
        private int _CurrentPage;
        [AccessedThroughProperty("ddlCategory")]
        private DropDownList _ddlCategory;
        [AccessedThroughProperty("dgModel")]
        private DataGrid _dgModel;
        [AccessedThroughProperty("dgOption")]
        private DataGrid _dgOption;
        [AccessedThroughProperty("dgOptionEdit")]
        private DataGrid _dgOptionEdit;
        [AccessedThroughProperty("dgRelated")]
        private DataGrid _dgRelated;
        [AccessedThroughProperty("labelCategory")]
        private UserControl _labelCategory;
        [AccessedThroughProperty("lblAddOption")]
        private Label _lblAddOption;
        [AccessedThroughProperty("lblAddOptionValue")]
        private Label _lblAddOptionValue;
        [AccessedThroughProperty("lblAll")]
        private Label _lblAll;
        [AccessedThroughProperty("lblCategories")]
        private Label _lblCategories;
        [AccessedThroughProperty("lblDocuments")]
        private Label _lblDocuments;
        [AccessedThroughProperty("lblGeneral")]
        private Label _lblGeneral;
        [AccessedThroughProperty("lblImages")]
        private Label _lblImages;
        [AccessedThroughProperty("lblModels")]
        private Label _lblModels;
        [AccessedThroughProperty("lblOptions")]
        private Label _lblOptions;
        [AccessedThroughProperty("lblRelatedProducts")]
        private Label _lblRelatedProducts;
        [AccessedThroughProperty("lblSelectedOptionID")]
        private Label _lblSelectedOptionID;
        [AccessedThroughProperty("optionvaluesdiv")]
        private HtmlGenericControl _optionvaluesdiv;
        protected int _PageIndex;
        [AccessedThroughProperty("plhMsg")]
        private PlaceHolder _plhMsg;
        [AccessedThroughProperty("pnlCategories")]
        private Panel _pnlCategories;
        [AccessedThroughProperty("pnlDocCtrl")]
        private Panel _pnlDocCtrl;
        [AccessedThroughProperty("pnlImageCtrl")]
        private Panel _pnlImageCtrl;
        [AccessedThroughProperty("pnlLang")]
        private Panel _pnlLang;
        [AccessedThroughProperty("pnlList")]
        private Panel _pnlList;
        [AccessedThroughProperty("pnlModel")]
        private Panel _pnlModel;
        [AccessedThroughProperty("pnlOptions")]
        private Panel _pnlOptions;
        [AccessedThroughProperty("pnlProduct")]
        private Panel _pnlProduct;
        [AccessedThroughProperty("pnlProductTabs")]
        private Panel _pnlProductTabs;
        [AccessedThroughProperty("pnlRelated")]
        private Panel _pnlRelated;
        [AccessedThroughProperty("productdetail")]
        private AdminProductDetail _productdetail;
        [AccessedThroughProperty("productdoc")]
        private AdminProductDoc _productdoc;
        [AccessedThroughProperty("productimage")]
        private AdminProductImage _productimage;
        [AccessedThroughProperty("productlist")]
        private AdminProductList _productlist;
        [AccessedThroughProperty("phPadding")]
        private PlaceHolder _phPadding;
        protected bool _Related;
        protected int _RtnTabID;
        protected int _selCatID;
        [AccessedThroughProperty("selectlang")]
        private SelectLang _selectlang;
        protected string _SkinSrc;
        [AccessedThroughProperty("tabs")]
        private HtmlGenericControl _tabs;
        [AccessedThroughProperty("tbloptions")]
        private HtmlTable _tbloptions;
        [AccessedThroughProperty("txtAddModels")]
        private TextBox _txtAddModels;
        [AccessedThroughProperty("txtAddOption")]
        private TextBox _txtAddOption;
        [AccessedThroughProperty("txtAddOptionValue")]
        private TextBox _txtAddOptionValue;
        protected int ProdID;

        public AdminProduct()
        {
            base.Load += new EventHandler(this.Page_Load);
            this.ProdID = -1;
            this._RtnTabID = -1;
            this._PageIndex = 1;
            this._CatID = -1;
            this._selCatID = -1;
            this._SkinSrc = "";
            this._Related = false;
            this._CurrentPage = 1;
        }

        private void AddModel(int ProdID)
        {
            ProductController controller = new ProductController();
            NB_Store_ProductsInfo objProductInfo = new NB_Store_ProductsInfo();
            objProductInfo = controller.GetProduct(ProdID, this.selectlang.SelectedLang);
            if (objProductInfo != null)
            {
                this.updateProduct();
                controller.AddNewModel(objProductInfo);
            }
        }

        private void AddOption(int ProdID)
        {
            ProductController controller = new ProductController();
            NB_Store_ProductsInfo objProductInfo = new NB_Store_ProductsInfo();
            objProductInfo = controller.GetProduct(ProdID, this.selectlang.SelectedLang);
            if (objProductInfo != null)
            {
                this.updateProduct();
                controller.AddNewOption(objProductInfo);
            }
        }

        private void AddOptionValue(int OptionID)
        {
            ProductController controller = new ProductController();
            NB_Store_OptionInfo objOptionInfo = new NB_Store_OptionInfo();
            objOptionInfo = controller.GetOption(OptionID, this.selectlang.SelectedLang);
            if (objOptionInfo != null)
            {
                this.updateProduct();
                controller.AddNewOptionValue(objOptionInfo);
            }
        }

        private void cmdAddCat_Click(object sender, EventArgs e)
        {
            if ((this.ddlCategory.SelectedValue != "-1") & Versioned.IsNumeric(this.ddlCategory.SelectedValue))
            {
                this.updateProduct();
                new ProductController().UpdateProductCategory(this.ProdID, Conversions.ToInteger(this.ddlCategory.SelectedValue));
                this.populateEdit();
            }
        }

        private void cmdAddModel_Click(object sender, EventArgs e)
        {
            try
            {
                if (Versioned.IsNumeric(this.txtAddModels.Text))
                {
                    int num2 = Conversions.ToInteger(this.txtAddModels.Text);
                    for (int i = 1; i <= num2; i++)
                    {
                        this.AddModel(this.ProdID);
                    }
                    this.populateEdit();
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void cmdAddOption_Click(object sender, EventArgs e)
        {
            try
            {
                if (Versioned.IsNumeric(this.txtAddOption.Text))
                {
                    int num2 = Conversions.ToInteger(this.txtAddOption.Text);
                    for (int i = 1; i <= num2; i++)
                    {
                        this.AddOption(this.ProdID);
                    }
                    this.populateEdit();
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void cmdAddOptionValue_Click(object sender, EventArgs e)
        {
            try
            {
                if (Versioned.IsNumeric(this.txtAddOptionValue.Text) && Versioned.IsNumeric(this.lblSelectedOptionID.Text))
                {
                    int optionID = Conversions.ToInteger(this.lblSelectedOptionID.Text);
                    int num3 = Conversions.ToInteger(this.txtAddOptionValue.Text);
                    for (int i = 1; i <= num3; i++)
                    {
                        this.AddOptionValue(optionID);
                    }
                    this.populateEdit();
                    this.populateOptionEdit(optionID);
                    this.optionvaluesdiv.Visible = true;
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void cmdAddSelected_Click(object sender, EventArgs e)
        {
            RelatedProducts.AddProductFromWishList(this.PortalId, Conversions.ToString(this.ProdID));
            this.Response.Redirect(this.EditUrl("ProdId", this.ProdID.ToString(), "AdminProduct", SharedFunctions.getUrlCookieInfo(this.PortalId, new string[] { "" })), true);
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            if (this._RtnTabID > 0)
            {
                this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this._RtnTabID, "", new string[] { "currentpage=" + this._PageIndex.ToString(), "CatID=" + this._CatID.ToString() }), true);
            }
            else if (this._CurrentPage > 0)
            {
                this.Response.Redirect(this.EditUrl("currentpage", this._CurrentPage.ToString(), "AdminProduct"), true);
            }
            else
            {
                this.Response.Redirect(this.EditUrl("AdminProduct"), true);
            }
        }

        private void cmdClearSelected_Click(object sender, EventArgs e)
        {
            SharedFunctions.setUrlCookieInfo(this.PortalId, this.Request);
            WishList.ClearList(this.PortalId);
            this.Response.Redirect(this.EditUrl("ProdId", this.ProdID.ToString(), "AdminProduct", SharedFunctions.getUrlCookieInfo(this.PortalId, new string[] { "" })), true);
        }

        private void cmdSelectRelated_Click(object sender, EventArgs e)
        {
            NB_Store_ProductsInfo info = this.updateProduct();
            if (info != null)
            {
                SharedFunctions.setUrlCookieInfo(this.PortalId, this.Request);
                this.Response.Redirect(this.EditUrl("ProdId", info.ProductID.ToString(), "AdminProduct", new string[] { "rel=1" }), true);
            }
        }

        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            if (this.Page.IsValid)
            {
                NB_Store_ProductsInfo info = this.updateProduct();
                if ((this._RtnTabID > 0) & (this.ProdID > 0))
                {
                    this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this._RtnTabID, "", new string[] { "currentpage=" + this._PageIndex.ToString(), "CatID=" + this._CatID.ToString() }), true);
                }
                else if ((info != null) & (this.ProdID == 0))
                {
                    if (this._RtnTabID > 0)
                    {
                        this.Response.Redirect(this.EditUrl("ProdId", info.ProductID.ToString(), "AdminProduct", new string[] { "RtnTab=" + this._RtnTabID.ToString() }), true);
                    }
                    else
                    {
                        this.Response.Redirect(this.EditUrl("ProdId", info.ProductID.ToString(), "AdminProduct"), true);
                    }
                }
                else if (this._CurrentPage > 0)
                {
                    this.Response.Redirect(this.EditUrl("currentpage", this._CurrentPage.ToString(), "AdminProduct"), true);
                }
                else
                {
                    this.Response.Redirect(this.EditUrl("AdminProduct"), true);
                }
            }
        }

        private void copyLang(bool ForceOverwrite)
        {
            ProductController controller = new ProductController();
            NB_Store_ProductsInfo objInfo = this.updateProduct();
            if (objInfo != null)
            {
                controller.CopyProductToLanguages(objInfo, ForceOverwrite);
            }
        }

        private void dgModel_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            DataGridItem item = e.Item;
            int modelID = int.Parse(e.CommandArgument.ToString());
            ProductController controller = new ProductController();
            NB_Store_ModelInfo model = controller.GetModel(modelID, SharedFunctions.GetCurrentCulture());
            if (model != null)
            {
                if (model.Deleted)
                {
                    model.Deleted = false;
                    controller.UpdateObjModel(model);
                }
                else if (controller.GetModelInOrders(modelID) > 0)
                {
                    model.QtyRemaining = 0;
                    model.Deleted = true;
                    controller.UpdateObjModel(model);
                }
                else
                {
                    controller.DeleteModel(this.PortalId, modelID);
                }
            }
            this.populateEdit();
        }

        private void dgModel_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;
            if (((item.ItemType == ListItemType.Item) | (item.ItemType == ListItemType.AlternatingItem)) | (item.ItemType == ListItemType.SelectedItem))
            {
                if (SharedFunctions.GetStoreSettingBoolean(this.PortalId, "allowcartmodellimit.flag"))
                {
                    this.dgModel.Columns[12].Visible = true;
                }
                else
                {
                    this.dgModel.Columns[12].Visible = false;
                }
                if (((NB_Store_ModelInfo) e.Item.DataItem).Deleted)
                {
                    TextBox box2 = (TextBox) e.Item.FindControl("txtModelRef");
                    TextBox box5 = (TextBox) e.Item.FindControl("txtModelName");
                    TextBox box6 = (TextBox) e.Item.FindControl("txtBarCode");
                    TextBox box7 = (TextBox) e.Item.FindControl("txtWeight");
                    TextBox box8 = (TextBox) e.Item.FindControl("txtUnitCost");
                    TextBox box9 = (TextBox) e.Item.FindControl("txtQtyRemaining");
                    TextBox box10 = (TextBox) e.Item.FindControl("txtListOrder");
                    CompareValidator validator = (CompareValidator) e.Item.FindControl("validatorWeight");
                    CompareValidator validator2 = (CompareValidator) e.Item.FindControl("validatorUnitPrice");
                    CompareValidator validator3 = (CompareValidator) e.Item.FindControl("validatorDealerCost");
                    CompareValidator validator4 = (CompareValidator) e.Item.FindControl("validatorPurchaseCost");
                    TextBox box11 = (TextBox) e.Item.FindControl("txtMaxStock");
                    TextBox box12 = (TextBox) e.Item.FindControl("txtDealerCost");
                    TextBox box3 = (TextBox) e.Item.FindControl("txtPurchaseCost");
                    TextBox box4 = (TextBox) e.Item.FindControl("txtExtra");
                    CheckBox box = (CheckBox) e.Item.FindControl("chkDealerOnly");
                    if (box2 != null)
                    {
                        box2.Enabled = false;
                    }
                    if (box5 != null)
                    {
                        box5.Enabled = false;
                    }
                    if (box6 != null)
                    {
                        box6.Enabled = false;
                    }
                    if (box7 != null)
                    {
                        box7.Enabled = false;
                    }
                    if (box8 != null)
                    {
                        box8.Enabled = false;
                    }
                    if (box9 != null)
                    {
                        box9.Enabled = false;
                    }
                    if (box10 != null)
                    {
                        box10.Enabled = false;
                    }
                    if (box11 != null)
                    {
                        box11.Enabled = false;
                    }
                    if (box12 != null)
                    {
                        box12.Enabled = false;
                    }
                    if (box3 != null)
                    {
                        box3.Enabled = false;
                    }
                    if (box4 != null)
                    {
                        box4.Enabled = false;
                    }
                    if (validator != null)
                    {
                        validator.Enabled = false;
                    }
                    if (validator2 != null)
                    {
                        validator2.Enabled = false;
                    }
                    if (validator3 != null)
                    {
                        validator3.Enabled = false;
                    }
                    if (validator4 != null)
                    {
                        validator4.Enabled = false;
                    }
                    if (box != null)
                    {
                        box.Enabled = false;
                    }
                    Control control = item.Controls[1].Controls[0];
                    if (control is ImageButton)
                    {
                        ImageButton button = (ImageButton) control;
                        if (item.ItemIndex == 0)
                        {
                            button.Visible = false;
                        }
                        else
                        {
                            button.Attributes.Add("onClick", "javascript:return confirm('" + DotNetNuke.Services.Localization.Localization.GetString("cmdRestoreModel", this.LocalResourceFile) + "');");
                            button.ImageUrl = "/images/restore.gif";
                            button.ToolTip = DotNetNuke.Services.Localization.Localization.GetString("tipRestoreModel", this.LocalResourceFile);
                        }
                    }
                }
                else
                {
                    TextBox box15 = (TextBox) e.Item.FindControl("txtUnitCost");
                    TextBox box13 = (TextBox) e.Item.FindControl("txtDealerCost");
                    TextBox box14 = (TextBox) e.Item.FindControl("txtPurchaseCost");
                    if ((box13 != null) && Versioned.IsNumeric(box13.Text))
                    {
                        box13.Text = Conversions.ToDouble(box13.Text).ToString();
                    }
                    if ((box14 != null) && Versioned.IsNumeric(box14.Text))
                    {
                        box14.Text = Conversions.ToDouble(box14.Text).ToString();
                    }
                    if ((box15 != null) && Versioned.IsNumeric(box15.Text))
                    {
                        box15.Text = Conversions.ToDouble(box15.Text).ToString();
                    }
                    Control control2 = item.Controls[1].Controls[0];
                    if (control2 is ImageButton)
                    {
                        ImageButton button2 = (ImageButton) control2;
                        if (item.ItemIndex == 0)
                        {
                            button2.Visible = false;
                        }
                        else
                        {
                            button2.Attributes.Add("onClick", "javascript:return confirm('" + DotNetNuke.Services.Localization.Localization.GetString("cmdDeleteModel", this.LocalResourceFile) + "');");
                            button2.ToolTip = DotNetNuke.Services.Localization.Localization.GetString("tipDeleteModel", this.LocalResourceFile);
                        }
                    }
                }
            }
        }

        private void dgModel_PreRender(object sender, EventArgs e)
        {
            DataGrid grid = (DataGrid) sender;
            if (grid.Controls.Count > 0)
            {
                ((ShowSelectLang) grid.Controls[0].Controls[0].Controls[0].FindControl("ShowSelectLang")).Refresh();
                ((ShowSelectLang) grid.Controls[0].Controls[0].Controls[0].FindControl("ShowSelectLang2")).Refresh();
                ((Label) grid.Controls[0].Controls[0].Controls[0].FindControl("nlName")).Text = DotNetNuke.Services.Localization.Localization.GetString("nlName", this.LocalResourceFile);
                ((Label) grid.Controls[0].Controls[0].Controls[0].FindControl("nlExtra")).Text = DotNetNuke.Services.Localization.Localization.GetString("nlExtra", this.LocalResourceFile);
            }
        }

        private void dgOption_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                DataGridItem item = e.Item;
                int optionID = int.Parse(e.CommandArgument.ToString());
                new ProductController().DeleteOption(optionID);
                this.populateEdit();
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void dgOption_EditCommand(object source, DataGridCommandEventArgs e)
        {
            int optionID = int.Parse(e.CommandArgument.ToString());
            this.dgOption.SelectedIndex = e.Item.ItemIndex;
            this.lblSelectedOptionID.Text = optionID.ToString();
            this.updateProduct();
            this.populateEdit();
            this.populateOptionEdit(optionID);
            this.optionvaluesdiv.Visible = true;
        }

        private void dgOption_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;
            if (((item.ItemType == ListItemType.Item) | (item.ItemType == ListItemType.AlternatingItem)) | (item.ItemType == ListItemType.SelectedItem))
            {
                Control control = item.Controls[2].Controls[0];
                if (control is ImageButton)
                {
                    ImageButton button = (ImageButton) control;
                    button.Attributes.Add("onClick", "javascript:return confirm('" + DotNetNuke.Services.Localization.Localization.GetString("cmdDeleteOption", this.LocalResourceFile) + "');");
                }
            }
        }

        private void dgOption_PreRender(object sender, EventArgs e)
        {
            DataGrid grid = (DataGrid) sender;
            if (grid.Controls.Count > 0)
            {
                ((ShowSelectLang) grid.Controls[0].Controls[0].Controls[0].FindControl("ShowSelectLang")).Refresh();
                ((Label) grid.Controls[0].Controls[0].Controls[0].FindControl("nlName")).Text = DotNetNuke.Services.Localization.Localization.GetString("nlName", this.LocalResourceFile);
            }
        }

        private void dgOptionEdit_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            try
            {
                DataGridItem item = e.Item;
                int optionValueID = int.Parse(e.CommandArgument.ToString());
                new ProductController().DeleteOptionValue(optionValueID);
                int optionID = Conversions.ToInteger(item.Cells[1].Text);
                this.populateEdit();
                this.populateOptionEdit(optionID);
                this.optionvaluesdiv.Visible = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void dgOptionEdit_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;
            if (((item.ItemType == ListItemType.Item) | (item.ItemType == ListItemType.AlternatingItem)) | (item.ItemType == ListItemType.SelectedItem))
            {
                TextBox box = (TextBox) e.Item.FindControl("txtAddedCost");
                if ((box != null) && Versioned.IsNumeric(box.Text))
                {
                    box.Text = Conversions.ToDouble(box.Text).ToString();
                }
                Control control = item.Controls[2].Controls[0];
                if (control is ImageButton)
                {
                    ImageButton button = (ImageButton) control;
                    button.Attributes.Add("onClick", "javascript:return confirm('" + DotNetNuke.Services.Localization.Localization.GetString("cmdDeleteOption", this.LocalResourceFile) + "');");
                }
            }
        }

        private void dgOptionEdit_PreRender(object sender, EventArgs e)
        {
            DataGrid grid = (DataGrid) sender;
            if (grid.Controls.Count > 0)
            {
                ((ShowSelectLang) grid.Controls[0].Controls[0].Controls[0].FindControl("ShowSelectLang")).Refresh();
                ((Label) grid.Controls[0].Controls[0].Controls[0].FindControl("nlName")).Text = DotNetNuke.Services.Localization.Localization.GetString("nlName", this.LocalResourceFile);
            }
        }

        private void dgRelated_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            DataGridItem item = e.Item;
            int relatedID = int.Parse(e.CommandArgument.ToString());
            new ProductController().DeleteProductRelated(relatedID);
            this.populateEdit();
        }

        private void dgRelated_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            DataGridItem item = e.Item;
            if (((item.ItemType == ListItemType.Item) | (item.ItemType == ListItemType.AlternatingItem)) | (item.ItemType == ListItemType.SelectedItem))
            {
                Control control2 = item.Controls[3].Controls[0];
                if (control2 is ImageButton)
                {
                    ImageButton button = (ImageButton) control2;
                    button.Attributes.Add("onClick", "javascript:return confirm('" + DotNetNuke.Services.Localization.Localization.GetString("cmdDelete", this.LocalResourceFile) + "');");
                    button.ToolTip = DotNetNuke.Services.Localization.Localization.GetString("cmdDelete", this.LocalResourceFile);
                }
                Control control = item.Controls[10].Controls[1];
                if (control is DropDownList)
                {
                    DropDownList list = (DropDownList) control;
                    list.SelectedValue = Conversions.ToString(((NB_Store_ProductRelatedListInfo) e.Item.DataItem).RelatedType);
                }
                if (((NB_Store_ProductRelatedListInfo) e.Item.DataItem).NotAvailable)
                {
                    item.Controls[6].Visible = false;
                    item.Controls[7].Visible = false;
                    item.Controls[8].Visible = false;
                    item.Controls[9].Visible = false;
                    item.Controls[10].Visible = false;
                    item.Controls[11].Visible = false;
                    item.Controls[12].Visible = false;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                this.ProdID = -1;
                if ((this.Request.QueryString["ProdID"] != null) && Versioned.IsNumeric(this.Request.QueryString["ProdID"]))
                {
                    this.ProdID = Conversions.ToInteger(this.Request.QueryString["ProdID"]);
                }
                SharedFunctions.setAdminCookieValue(this.PortalId, "ProdID", this.ProdID.ToString());
                if (this.Request.QueryString["SkinSrc"] != null)
                {
                    this._SkinSrc = this.Request.QueryString["SkinSrc"];
                }
                this._CatID = -1;
                if ((this.Request.QueryString["CatID"] != null) && Versioned.IsNumeric(this.Request.QueryString["CatID"]))
                {
                    this._CatID = Conversions.ToInteger(this.Request.QueryString["CatID"]);
                }
                this._RtnTabID = -1;
                if ((this.Request.QueryString["RtnTab"] != null) && Versioned.IsNumeric(this.Request.QueryString["RtnTab"]))
                {
                    this._RtnTabID = Conversions.ToInteger(this.Request.QueryString["RtnTab"]);
                }
                this._PageIndex = -1;
                if ((this.Request.QueryString["PageIndex"] != null) && Versioned.IsNumeric(this.Request.QueryString["PageIndex"]))
                {
                    this._PageIndex = Conversions.ToInteger(this.Request.QueryString["PageIndex"]);
                }
                this._CurrentPage = 1;
                if ((this.Request.QueryString["currentpage"] != null) && Versioned.IsNumeric(this.Request.QueryString["currentpage"]))
                {
                    this._CurrentPage = Conversions.ToInteger(this.Request.QueryString["currentpage"]);
                }
                this._Related = false;
                if ((this.Request.QueryString["rel"] != null) && (this.Request.QueryString["rel"] == "1"))
                {
                    this._Related = true;
                }
                if (this.ProdID == 0)
                {
                    this.cmdUpdate.Text = DotNetNuke.Services.Localization.Localization.GetString("CreateProduct", this.LocalResourceFile);
                    this.pnlCategories.Visible = false;
                    this.tabs.Visible = false;
                }
                else
                {
                    this.tabs.Visible = true;
                    this.cmdUpdate.Text = DotNetNuke.Services.Localization.Localization.GetString("cmdUpdate");
                }
                if (this._SkinSrc.EndsWith("Edit") | this._Related)
                {
                    base.BackOfficeMenu.Visible = false;
                }
                else
                {
                    base.BackOfficeMenu.Visible = true;
                }
                if (!this.Page.IsPostBack && !this.ReachedProductLimit())
                {
                    WishList.ClearList(this.PortalId);
                    if ((this.ProdID == -1) | this._Related)
                    {
                        this.populateList();
                    }
                    else
                    {
                        this.pnlProductTabs.Visible = true;
                        this.populateEdit();
                    }
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exc = exception1;
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException((PortalModuleBase) this, exc);
                ProjectData.ClearProjectError();
            }
        }

        private void populateCatList(int ProdID)
        {
            SharedFunctions.populateCategoryCheckBoxList(this.PortalSettings.PortalId, ProdID, this.cblCategories);
        }

        private void populateEdit()
        {
            ProductController controller = new ProductController();
            NB_Store_ProductsInfo objInfo = new NB_Store_ProductsInfo();
            this.pnlList.Visible = false;
            this.pnlImageCtrl.Visible = true;
            this.pnlLang.Visible = true;
            this.pnlModel.Visible = true;
            this.pnlOptions.Visible = true;
            this.pnlProduct.Visible = true;
            this.optionvaluesdiv.Visible = false;
            this.pnlDocCtrl.Visible = true;
            this.pnlRelated.Visible = true;
            this.dgOption.SelectedIndex = -1;
            if (SharedFunctions.IsOnlyManagerLite(this.PortalId, this.UserInfo))
            {
                this.pnlRelated.Visible = false;
                this.pnlOptions.Visible = false;
            }
            objInfo = controller.GetProduct(this.ProdID, this.selectlang.SelectedLang);
            if (objInfo == null)
            {
                objInfo = controller.GetProduct(this.ProdID, SharedFunctions.GetCurrentCulture());
                this.selectlang.SelectedLang = SharedFunctions.GetCurrentCulture();
            }
            if (objInfo != null)
            {
                this.phPadding.Controls.Add(new LiteralControl("<div class=\"NBright_NameHeader\">" + objInfo.ProductName + "</div>"));
                this.productdetail.populateDetails(objInfo);
                SharedFunctions.populateCategoryList(this.PortalSettings.PortalId, this.ddlCategory, "-1", "", Conversions.ToString(-1));
                this.populateCatList(objInfo.ProductID);
                this.populateModel(objInfo.ProductID);
                this.populateOptions(objInfo.ProductID);
                this.productimage.populateImages(objInfo.ProductID, this.selectlang.SelectedLang);
                this.productdoc.populateDocs(objInfo.ProductID, this.selectlang.SelectedLang);
                this.populateRelated(objInfo.ProductID);
            }
            else
            {
                this.ProdID = 0;
                objInfo = new NB_Store_ProductsInfo {
                    PortalID = this.PortalId,
                    Lang = SharedFunctions.GetCurrentCulture(),
                    ProductID = -1
                };
                this.productdetail.populateDetails(objInfo);
                SharedFunctions.populateCategoryList(this.PortalSettings.PortalId, this.ddlCategory, "-1", "", Conversions.ToString(-1));
                this.populateCatList(-1);
                this.pnlModel.Visible = false;
                this.pnlImageCtrl.Visible = false;
                this.pnlOptions.Visible = false;
                this.pnlDocCtrl.Visible = false;
                this.pnlRelated.Visible = false;
            }
        }

        private void populateList()
        {
            this.pnlProduct.Visible = false;
            this.pnlModel.Visible = false;
            this.pnlLang.Visible = false;
            this.pnlImageCtrl.Visible = false;
            this.pnlDocCtrl.Visible = false;
            this.pnlOptions.Visible = false;
            this.pnlList.Visible = true;
            this.pnlProductTabs.Visible = false;
            this.pnlRelated.Visible = false;
            this.productlist.populateList();
        }

        private void populateModel(int ProductID)
        {
            ProductController controller = new ProductController();
            DataGrid dgModel = this.dgModel;
            DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(ref dgModel, this.LocalResourceFile);
            this.dgModel = dgModel;
            ArrayList list = controller.GetModelList(this.PortalId, ProductID, this.selectlang.SelectedLang, true);
            this.dgModel.DataSource = list;
            this.dgModel.DataBind();
        }

        private void populateOptionEdit(int OptionID)
        {
            ProductController controller = new ProductController();
            DataGrid dgOptionEdit = this.dgOptionEdit;
            DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(ref dgOptionEdit, this.LocalResourceFile);
            this.dgOptionEdit = dgOptionEdit;
            ArrayList optionValueList = controller.GetOptionValueList(OptionID, this.selectlang.SelectedLang);
            this.dgOptionEdit.DataSource = optionValueList;
            this.dgOptionEdit.DataBind();
        }

        private void populateOptions(int ProductID)
        {
            ProductController controller = new ProductController();
            DataGrid dgOption = this.dgOption;
            DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(ref dgOption, this.LocalResourceFile);
            this.dgOption = dgOption;
            ArrayList optionList = controller.GetOptionList(ProductID, this.selectlang.SelectedLang);
            this.dgOption.DataSource = optionList;
            this.dgOption.DataBind();
        }

        private void populateRelated(int ProductID)
        {
            ProductController controller = new ProductController();
            DataGrid dgRelated = this.dgRelated;
            DotNetNuke.Services.Localization.Localization.LocalizeDataGrid(ref dgRelated, this.LocalResourceFile);
            this.dgRelated = dgRelated;
            int itemCountInt = WishList.GetItemCountInt(this.PortalId);
            if (itemCountInt == 0)
            {
                this.cmdAddSelected.Visible = false;
                this.cmdClearSelected.Visible = false;
            }
            else
            {
                string str = Strings.Replace(DotNetNuke.Services.Localization.Localization.GetString("cmdAddSelected", this.LocalResourceFile), "[COUNT]", itemCountInt.ToString(), 1, -1, CompareMethod.Binary);
                this.cmdAddSelected.Text = str;
            }
            ArrayList list = controller.GetProductRelatedList(this.PortalId, ProductID, this.selectlang.SelectedLang, -1, true);
            this.dgRelated.DataSource = list;
            this.dgRelated.DataBind();
        }

        private void productdoc_AddButton(object sender, EventArgs e)
        {
            this.updateProduct();
            this.productdoc.UploadDoc(this.ProdID, this.selectlang.SelectedLang);
            this.UpdateShippingData(this.ProdID, 1);
            this.ReturnToProduct();
        }

        private void productdoc_DeleteDoc(int DocID)
        {
            this.UpdateShippingData(this.ProdID);
            this.updateModels();
            this.ReturnToProduct();
        }

        private void productdoc_SearchDocs(string FilterText)
        {
            if (FilterText == "")
            {
                this.productdoc.HideSelectList();
            }
            else
            {
                this.productdoc.populateSelectDocs(this.selectlang.SelectedLang, FilterText);
            }
        }

        private void productdoc_SelectDoc(string FileName, string DocDesc, string DocPath, string FileExt)
        {
            ProductController controller = new ProductController();
            NB_Store_ProductDocInfo objInfo = new NB_Store_ProductDocInfo();
            if (DocDesc == "&nbsp;")
            {
                DocDesc = "";
            }
            objInfo.DocID = -1;
            objInfo.DocDesc = DocDesc;
            objInfo.DocPath = DocPath;
            objInfo.FileExt = FileExt;
            objInfo.FileName = FileName;
            objInfo.Lang = this.selectlang.SelectedLang;
            objInfo.Hidden = false;
            objInfo.ListOrder = 1;
            objInfo.ProductID = this.ProdID;
            controller.UpdateObjProductDoc(objInfo);
            this.productdoc.HideSelectList();
            this.productdoc.populateDocs(this.ProdID, this.selectlang.SelectedLang);
        }

        private void productimage_AddButton(object sender, EventArgs e)
        {
            int imageSize = 450;
            SettingsController controller = new SettingsController();
            this.updateProduct();
            NB_Store_SettingsInfo info = controller.GetSetting(this.PortalId, "image.resize", "None");
            if ((info != null) && Versioned.IsNumeric(info.SettingValue))
            {
                if (Conversions.ToInteger(info.SettingValue) >= 50)
                {
                    imageSize = Conversions.ToInteger(info.SettingValue);
                }
                else
                {
                    imageSize = 0;
                }
            }
            int imageQuality = 0x55;
            info = controller.GetSetting(this.PortalId, "image.quality", "None");
            if ((info != null) && Versioned.IsNumeric(info.SettingValue))
            {
                imageQuality = Conversions.ToInteger(info.SettingValue);
            }
            int interpolationMode = 7;
            int smoothingMode = 2;
            int pixelOffsetMode = 0;
            int compositingQuality = 0;
            info = controller.GetSetting(this.PortalId, "image.advanced", "None");
            if (info != null)
            {
                string[] strArray = info.SettingValue.Split(new char[] { ',' });
                if (strArray.GetUpperBound(0) == 3)
                {
                    if (Versioned.IsNumeric(strArray[0]))
                    {
                        interpolationMode = Conversions.ToInteger(strArray[0]);
                    }
                    if (Versioned.IsNumeric(strArray[1]))
                    {
                        smoothingMode = Conversions.ToInteger(strArray[1]);
                    }
                    if (Versioned.IsNumeric(strArray[2]))
                    {
                        pixelOffsetMode = Conversions.ToInteger(strArray[2]);
                    }
                    if (Versioned.IsNumeric(strArray[3]))
                    {
                        compositingQuality = Conversions.ToInteger(strArray[3]);
                    }
                }
            }
            this.productimage.UploadImage(this.ProdID, this.selectlang.SelectedLang, imageSize, imageQuality, interpolationMode, smoothingMode, pixelOffsetMode, compositingQuality);
            this.ReturnToProduct();
        }

        private void productimage_DeleteImage()
        {
            this.updateProduct();
            this.ReturnToProduct();
        }

        private void productlist_AddButton(object sender, EventArgs e)
        {
            SharedFunctions.setUrlCookieInfo(this.PortalId, this.Request);
            this.Response.Redirect(this.EditUrl("ProdId", "0", "AdminProduct"), true);
        }

        private void productlist_AddRelated(int ProductID, int RelatedID)
        {
            RelatedProducts.AddProduct(this.PortalId, Conversions.ToString(ProductID), Conversions.ToString(RelatedID));
            this.Response.Redirect(this.EditUrl("ProdId", ProductID.ToString(), "AdminProduct", SharedFunctions.getUrlCookieInfo(this.PortalId, new string[] { "" })), true);
        }

        private void productlist_EditCommand(object source, DataGridCommandEventArgs e)
        {
            string keyValue = e.CommandArgument.ToString();
            SharedFunctions.setUrlCookieInfo(this.PortalId, this.Request);
            this.Response.Redirect(this.EditUrl("ProdId", keyValue, "AdminProduct", new string[] { "currentpage=" + Conversions.ToString(this._CurrentPage) }));
        }

        private void productlist_ItemCommand(object source, DataGridCommandEventArgs e)
        {
            this.Response.Redirect(this.EditUrl("AdminProduct"), true);
        }

        private void productlist_ReturnButton(object sender, EventArgs e)
        {
            this.Response.Redirect(this.EditUrl("ProdId", this.ProdID.ToString(), "AdminProduct", SharedFunctions.getUrlCookieInfo(this.PortalId, new string[] { "" })), true);
        }

        private bool ReachedProductLimit()
        {
            NB_Store_SettingsInfo info = new SettingsController().GetSetting(this.PortalId, "product.limit", "None");
            if (((info != null) && Versioned.IsNumeric(info.SettingValue)) && (Conversions.ToInteger(info.SettingValue) >= 1))
            {
                ProductController controller2 = new ProductController();
                if (controller2.GetProductCount(this.PortalId) >= Conversions.ToInteger(info.SettingValue))
                {
                    SharedFunctions.DisplayMsgText(Conversions.ToString(this.PortalId), this.plhMsg, "productlimit.text", "Product Limit Reached");
                    this.pnlImageCtrl.Visible = false;
                    this.pnlDocCtrl.Visible = false;
                    this.pnlLang.Visible = false;
                    this.pnlList.Visible = false;
                    this.pnlModel.Visible = false;
                    this.pnlProduct.Visible = false;
                    this.pnlOptions.Visible = false;
                    return true;
                }
            }
            return false;
        }

        private void ReturnToProduct()
        {
            if (this._RtnTabID > -1)
            {
                this.Response.Redirect(this.EditUrl("ProdId", this.ProdID.ToString(), "AdminProduct", new string[] { "RtnTab=" + Conversions.ToString(this._RtnTabID), "PageIndex=" + Conversions.ToString(this._PageIndex), "CatID=" + Conversions.ToString(this._CatID) }), true);
            }
            else
            {
                this.Response.Redirect(this.EditUrl("ProdId", this.ProdID.ToString(), "AdminProduct"), true);
            }
        }

        private void selectlang_AfterChange(object source, DataListCommandEventArgs e, string PreviousEditLang)
        {
            if (e.CommandName == "Change")
            {
                this.populateEdit();
            }
        }

        private void selectlang_BeforeChange(object source, DataListCommandEventArgs e, string NewEditLang)
        {
            if (e.CommandName == "Change")
            {
                NB_Store_ProductsInfo info = new NB_Store_ProductsInfo();
                info = this.updateProduct();
                if (this.ProdID == 0)
                {
                    this.selectlang.SelectedLang = NewEditLang;
                    this.Response.Redirect(this.EditUrl("ProdId", info.ProductID.ToString(), "AdminProduct"));
                }
            }
        }

        private void ShowDocUpload()
        {
            this.pnlList.Visible = false;
            this.pnlLang.Visible = false;
            this.pnlModel.Visible = false;
            this.pnlOptions.Visible = false;
            this.pnlProduct.Visible = false;
            this.pnlImageCtrl.Visible = false;
            this.optionvaluesdiv.Visible = false;
            this.pnlDocCtrl.Visible = true;
            this.productdoc.populateSelectDocs(this.selectlang.SelectedLang, "");
        }

        private void updateCatList(NB_Store_ProductsInfo objInfo)
        {
            IEnumerator enumerator=null;
            ProductController controller = new ProductController();
            controller.DeleteProductCategory(objInfo.ProductID);
            try
            {
                enumerator = this.cblCategories.Items.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    ListItem current = (ListItem) enumerator.Current;
                    if (current.Selected)
                    {
                        controller.UpdateProductCategory(objInfo.ProductID, Conversions.ToInteger(current.Value));
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        }

        private void updateModels()
        {
            IEnumerator enumerator=null;
            ProductController controller = new ProductController();
            PromoController controller2 = new PromoController();
            try
            {
                enumerator = this.dgModel.Items.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    DataGridItem current = (DataGridItem) enumerator.Current;
                    int modelID = Conversions.ToInteger(current.Cells[0].Text);
                    NB_Store_ModelInfo model = controller.GetModel(modelID, this.selectlang.SelectedLang);
                    if (model != null)
                    {
                        model.Barcode = ((TextBox) current.FindControl("txtBarCode")).Text;
                        model.ModelName = ((TextBox) current.FindControl("txtModelName")).Text;
                        model.Extra = ((TextBox) current.FindControl("txtExtra")).Text;
                        model.ModelRef = ((TextBox) current.FindControl("txtModelRef")).Text;
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtDealerCost")).Text))
                        {
                            model.DealerCost = Conversions.ToDecimal(((TextBox) current.FindControl("txtDealerCost")).Text);
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtPurchaseCost")).Text))
                        {
                            model.PurchaseCost = Conversions.ToDecimal(((TextBox) current.FindControl("txtPurchaseCost")).Text);
                        }
                        model.DealerOnly = ((CheckBox) current.FindControl("chkDealerOnly")).Checked;
                        model.QtyStockSet = Conversions.ToInteger(((TextBox) current.FindControl("txtMaxStock")).Text);
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtQtyRemaining")).Text))
                        {
                            model.QtyRemaining = Conversions.ToInteger(((TextBox) current.FindControl("txtQtyRemaining")).Text);
                            if (model.QtyRemaining > model.QtyStockSet)
                            {
                                model.QtyStockSet = Conversions.ToInteger(((TextBox) current.FindControl("txtQtyRemaining")).Text);
                            }
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtAllow")).Text))
                        {
                            model.Allow = Conversions.ToInteger(((TextBox) current.FindControl("txtAllow")).Text);
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtUnitCost")).Text))
                        {
                            model.UnitCost = Conversions.ToDecimal(((TextBox) current.FindControl("txtUnitCost")).Text);
                            if (((decimal.Compare(model.UnitCost, decimal.Zero) > 0) & (decimal.Compare(model.DealerCost, decimal.Zero) == 0)) & !SharedFunctions.GetStoreSettingBoolean(this.PortalId, "allowzerodealerprice.flag"))
                            {
                                model.DealerCost = model.UnitCost;
                            }
                        }
                        model.Lang = this.selectlang.SelectedLang;
                        model.ListOrder = Conversions.ToInteger(((TextBox) current.FindControl("txtListOrder")).Text);
                        controller.UpdateObjModel(model);
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtWeight")).Text))
                        {
                            this.UpdateShippingData(model, Conversions.ToDecimal(((TextBox) current.FindControl("txtWeight")).Text), this.productdoc.DocsCount());
                        }
                        controller2.createSalePriceTable(this.PortalId, modelID);
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        }

        private void updateOptions()
        {
            ProductController controller = new ProductController();
            if (this.dgOption.Visible)
            {
                IEnumerator enumerator=null;
                try
                {
                    enumerator = this.dgOption.Items.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataGridItem current = (DataGridItem) enumerator.Current;
                        int optionID = Conversions.ToInteger(current.Cells[0].Text);
                        NB_Store_OptionInfo option = controller.GetOption(optionID, this.selectlang.SelectedLang);
                        if (option != null)
                        {
                            option.OptionDesc = ((TextBox) current.FindControl("txtOptionDesc")).Text;
                            option.ListOrder = Conversions.ToInteger(((TextBox) current.FindControl("txtListOrder")).Text);
                            option.Lang = this.selectlang.SelectedLang;
                            option.Attributes = "";
                            controller.UpdateObjOption(option);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
        }

        private void updateOptionValues()
        {
            ProductController controller = new ProductController();
            if (this.dgOptionEdit.Visible)
            {
                IEnumerator enumerator=null;
                try
                {
                    enumerator = this.dgOptionEdit.Items.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        DataGridItem current = (DataGridItem) enumerator.Current;
                        int optionValueID = Conversions.ToInteger(current.Cells[0].Text);
                        NB_Store_OptionValueInfo optionValue = controller.GetOptionValue(optionValueID, this.selectlang.SelectedLang);
                        if (optionValue != null)
                        {
                            optionValue.OptionValueDesc = ((TextBox) current.FindControl("txtOptionValueDesc")).Text;
                            if (Versioned.IsNumeric(((TextBox) current.FindControl("txtAddedCost")).Text))
                            {
                                optionValue.AddedCost = Conversions.ToDecimal(((TextBox) current.FindControl("txtAddedCost")).Text);
                            }
                            optionValue.Lang = this.selectlang.SelectedLang;
                            optionValue.ListOrder = Conversions.ToInteger(((TextBox) current.FindControl("txtListOrder")).Text);
                            controller.UpdateObjOptionValue(optionValue);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
            }
        }

        private NB_Store_ProductsInfo updateProduct()
        {
            ProductController controller = new ProductController();
            bool isDeleted = false;
            bool archived = false;
            if (this.ProdID > 0)
            {
                NB_Store_ProductsInfo product = controller.GetProduct(this.ProdID, this.selectlang.SelectedLang);
                isDeleted = product.IsDeleted;
                archived = product.Archived;
            }
            SharedFunctions.CreateDir(this.PortalSettings, "productimages");
            SharedFunctions.CreateDir(this.PortalSettings, "productdocs");
            NB_Store_ProductsInfo objInfo = this.productdetail.UpdateDetails(this.selectlang.SelectedLang, this.UserId, this.ProdID);
            this.updateCatList(objInfo);
            if (this.ProdID == 0)
            {
                controller.AddNewModel(objInfo);
            }
            else
            {
                this.updateModels();
                this.updateOptions();
                this.updateOptionValues();
                this.productimage.updateImages(this.selectlang.SelectedLang);
                this.productdoc.updateDocs(this.selectlang.SelectedLang);
                this.updateRelated();
            }
            controller.CopyProductToLanguages(objInfo, false);
            if (objInfo.IsDeleted)
            {
                if ((controller.GetProductInOrders(objInfo.ProductID) == 0) & !SharedFunctions.GetStoreSettingBoolean(this.PortalId, "ProductMarkOnDelete.flag"))
                {
                    controller.DeleteProduct(objInfo.ProductID);
                    if (this._RtnTabID > 0)
                    {
                        this.Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(this._RtnTabID, "", new string[] { "currentpage=" + this._PageIndex.ToString(), "CatID=" + this._CatID.ToString() }), true);
                    }
                    else
                    {
                        this.Response.Redirect(this.EditUrl("AdminProduct"), true);
                    }
                }
                else if (!isDeleted)
                {
                    controller.NotAvailableProductRelated(objInfo.ProductID, true);
                }
            }
            else if (isDeleted)
            {
                controller.NotAvailableProductRelated(objInfo.ProductID, false);
            }
            if (objInfo.Archived)
            {
                if (!archived)
                {
                    controller.NotAvailableProductRelated(objInfo.ProductID, true);
                }
            }
            else if (archived)
            {
                controller.NotAvailableProductRelated(objInfo.ProductID, false);
            }
            SharedFunctions.ClearProductCache(this.PortalId, objInfo.ProductID);
            return objInfo;
        }

        private void updateRelated()
        {
            IEnumerator enumerator=null;
            ProductController controller = new ProductController();
            try
            {
                enumerator = this.dgRelated.Items.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    DataGridItem current = (DataGridItem) enumerator.Current;
                    int relatedID = Conversions.ToInteger(current.Cells[0].Text);
                    NB_Store_ProductRelatedInfo productRelated = controller.GetProductRelated(relatedID);
                    if (productRelated != null)
                    {
                        productRelated.BiDirectional = ((CheckBox) current.FindControl("chkBiDirectional")).Checked;
                        productRelated.Disabled = !((CheckBox) current.FindControl("chkEnabled")).Checked;
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtDiscountAmt")).Text))
                        {
                            productRelated.DiscountAmt = Conversions.ToDecimal(((TextBox) current.FindControl("txtDiscountAmt")).Text);
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtDiscountPercent")).Text))
                        {
                            productRelated.DiscountPercent = Conversions.ToDecimal(((TextBox) current.FindControl("txtDiscountPercent")).Text);
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtMaxQty")).Text))
                        {
                            productRelated.MaxQty = Conversions.ToInteger(((TextBox) current.FindControl("txtMaxQty")).Text);
                        }
                        if (Versioned.IsNumeric(((TextBox) current.FindControl("txtProductQty")).Text))
                        {
                            productRelated.ProductQty = Conversions.ToInteger(((TextBox) current.FindControl("txtProductQty")).Text);
                        }
                        productRelated.RelatedType = Conversions.ToInteger(((DropDownList) current.FindControl("ddlRelatedType")).SelectedValue);
                        controller.UpdateObjProductRelated(productRelated);
                    }
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        }

        private void UpdateShippingData(int ProductID)
        {
            ArrayList productDocList = new ProductController().GetProductDocList(ProductID, SharedFunctions.GetCurrentCulture());
            this.UpdateShippingData(ProductID, productDocList.Count);
        }

        private void UpdateShippingData(int ProductID, int ProductDocCount)
        {
            IEnumerator enumerator=null;
            ArrayList list = new ProductController().GetModelList(this.PortalId, ProductID, SharedFunctions.GetCurrentCulture(), true);
            try
            {
                enumerator = list.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    NB_Store_ModelInfo current = (NB_Store_ModelInfo) enumerator.Current;
                    this.UpdateShippingData(current, current.Weight, ProductDocCount);
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
        }

        private void UpdateShippingData(NB_Store_ModelInfo objMInfo, decimal NewWeight, int ProductDocCount)
        {
            ShipController controller = new ShipController();
            bool flag = false;
            NB_Store_ShippingRatesInfo objInfo = controller.GetShippingRateByObjID(this.PortalId, objMInfo.ModelID, "PRD", -1);
            if ((objInfo != null) && ((((decimal.Compare(objInfo.ShipCost, decimal.Zero) > 0) | (decimal.Compare(objInfo.ProductLength, decimal.Zero) > 0)) | (decimal.Compare(objInfo.ProductWidth, decimal.Zero) > 0)) | (decimal.Compare(objInfo.ProductHeight, decimal.Zero) > 0)))
            {
                flag = true;
            }
            if ((decimal.Compare(NewWeight, decimal.Zero) > 0) | (ProductDocCount > 0))
            {
                flag = true;
            }
            if (flag)
            {
                if (objInfo == null)
                {
                    objInfo = new NB_Store_ShippingRatesInfo {
                        ItemId = 0,
                        Description = objMInfo.ModelRef + " - " + objMInfo.ModelName,
                        Disable = false,
                        ObjectId = objMInfo.ModelID,
                        PortalID = this.PortalId,
                        ProductHeight = decimal.Zero,
                        ProductLength = decimal.Zero,
                        ProductWeight = NewWeight,
                        ProductWidth = decimal.Zero,
                        Range1 = decimal.Zero,
                        Range2 = decimal.Zero,
                        ShipCost = decimal.Zero,
                        ShipType = "PRD",
                        ShipMethodID = -1
                    };
                }
                else
                {
                    objInfo.ProductWeight = NewWeight;
                }
                controller.UpdateObjShippingRate(objInfo);
            }
            else if (objInfo != null)
            {
                controller.DeleteShippingRate(objInfo.ItemId);
            }
        }

        protected virtual CheckBoxList cblCategories
        {
            get
            {
                return this._cblCategories;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._cblCategories = value;
            }
        }

        protected virtual LinkButton cmdAddCat
        {
            get
            {
                return this._cmdAddCat;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdAddCat_Click);
                if (this._cmdAddCat != null)
                {
                    this._cmdAddCat.Click -= handler;
                }
                this._cmdAddCat = value;
                if (this._cmdAddCat != null)
                {
                    this._cmdAddCat.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdAddModel
        {
            get
            {
                return this._cmdAddModel;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdAddModel_Click);
                if (this._cmdAddModel != null)
                {
                    this._cmdAddModel.Click -= handler;
                }
                this._cmdAddModel = value;
                if (this._cmdAddModel != null)
                {
                    this._cmdAddModel.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdAddOption
        {
            get
            {
                return this._cmdAddOption;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdAddOption_Click);
                if (this._cmdAddOption != null)
                {
                    this._cmdAddOption.Click -= handler;
                }
                this._cmdAddOption = value;
                if (this._cmdAddOption != null)
                {
                    this._cmdAddOption.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdAddOptionValue
        {
            get
            {
                return this._cmdAddOptionValue;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdAddOptionValue_Click);
                if (this._cmdAddOptionValue != null)
                {
                    this._cmdAddOptionValue.Click -= handler;
                }
                this._cmdAddOptionValue = value;
                if (this._cmdAddOptionValue != null)
                {
                    this._cmdAddOptionValue.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdAddSelected
        {
            get
            {
                return this._cmdAddSelected;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdAddSelected_Click);
                if (this._cmdAddSelected != null)
                {
                    this._cmdAddSelected.Click -= handler;
                }
                this._cmdAddSelected = value;
                if (this._cmdAddSelected != null)
                {
                    this._cmdAddSelected.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdCancel
        {
            get
            {
                return this._cmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdCancel_Click);
                if (this._cmdCancel != null)
                {
                    this._cmdCancel.Click -= handler;
                }
                this._cmdCancel = value;
                if (this._cmdCancel != null)
                {
                    this._cmdCancel.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdClearSelected
        {
            get
            {
                return this._cmdClearSelected;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdClearSelected_Click);
                if (this._cmdClearSelected != null)
                {
                    this._cmdClearSelected.Click -= handler;
                }
                this._cmdClearSelected = value;
                if (this._cmdClearSelected != null)
                {
                    this._cmdClearSelected.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdSelectRelated
        {
            get
            {
                return this._cmdSelectRelated;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdSelectRelated_Click);
                if (this._cmdSelectRelated != null)
                {
                    this._cmdSelectRelated.Click -= handler;
                }
                this._cmdSelectRelated = value;
                if (this._cmdSelectRelated != null)
                {
                    this._cmdSelectRelated.Click += handler;
                }
            }
        }

        protected virtual LinkButton cmdUpdate
        {
            get
            {
                return this._cmdUpdate;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.cmdUpdate_Click);
                if (this._cmdUpdate != null)
                {
                    this._cmdUpdate.Click -= handler;
                }
                this._cmdUpdate = value;
                if (this._cmdUpdate != null)
                {
                    this._cmdUpdate.Click += handler;
                }
            }
        }

        protected virtual DropDownList ddlCategory
        {
            get
            {
                return this._ddlCategory;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._ddlCategory = value;
            }
        }

        protected virtual DataGrid dgModel
        {
            get
            {
                return this._dgModel;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                DataGridItemEventHandler handler = new DataGridItemEventHandler(this.dgModel_ItemDataBound);
                EventHandler handler2 = new EventHandler(this.dgModel_PreRender);
                DataGridCommandEventHandler handler3 = new DataGridCommandEventHandler(this.dgModel_DeleteCommand);
                if (this._dgModel != null)
                {
                    this._dgModel.ItemDataBound -= handler;
                    this._dgModel.PreRender -= handler2;
                    this._dgModel.DeleteCommand -= handler3;
                }
                this._dgModel = value;
                if (this._dgModel != null)
                {
                    this._dgModel.ItemDataBound += handler;
                    this._dgModel.PreRender += handler2;
                    this._dgModel.DeleteCommand += handler3;
                }
            }
        }

        protected virtual DataGrid dgOption
        {
            get
            {
                return this._dgOption;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.dgOption_PreRender);
                DataGridItemEventHandler handler2 = new DataGridItemEventHandler(this.dgOption_ItemDataBound);
                DataGridCommandEventHandler handler3 = new DataGridCommandEventHandler(this.dgOption_EditCommand);
                DataGridCommandEventHandler handler4 = new DataGridCommandEventHandler(this.dgOption_DeleteCommand);
                if (this._dgOption != null)
                {
                    this._dgOption.PreRender -= handler;
                    this._dgOption.ItemDataBound -= handler2;
                    this._dgOption.EditCommand -= handler3;
                    this._dgOption.DeleteCommand -= handler4;
                }
                this._dgOption = value;
                if (this._dgOption != null)
                {
                    this._dgOption.PreRender += handler;
                    this._dgOption.ItemDataBound += handler2;
                    this._dgOption.EditCommand += handler3;
                    this._dgOption.DeleteCommand += handler4;
                }
            }
        }

        protected virtual DataGrid dgOptionEdit
        {
            get
            {
                return this._dgOptionEdit;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                EventHandler handler = new EventHandler(this.dgOptionEdit_PreRender);
                DataGridItemEventHandler handler2 = new DataGridItemEventHandler(this.dgOptionEdit_ItemDataBound);
                DataGridCommandEventHandler handler3 = new DataGridCommandEventHandler(this.dgOptionEdit_DeleteCommand);
                if (this._dgOptionEdit != null)
                {
                    this._dgOptionEdit.PreRender -= handler;
                    this._dgOptionEdit.ItemDataBound -= handler2;
                    this._dgOptionEdit.DeleteCommand -= handler3;
                }
                this._dgOptionEdit = value;
                if (this._dgOptionEdit != null)
                {
                    this._dgOptionEdit.PreRender += handler;
                    this._dgOptionEdit.ItemDataBound += handler2;
                    this._dgOptionEdit.DeleteCommand += handler3;
                }
            }
        }

        protected virtual DataGrid dgRelated
        {
            get
            {
                return this._dgRelated;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                DataGridItemEventHandler handler = new DataGridItemEventHandler(this.dgRelated_ItemDataBound);
                DataGridCommandEventHandler handler2 = new DataGridCommandEventHandler(this.dgRelated_DeleteCommand);
                if (this._dgRelated != null)
                {
                    this._dgRelated.ItemDataBound -= handler;
                    this._dgRelated.DeleteCommand -= handler2;
                }
                this._dgRelated = value;
                if (this._dgRelated != null)
                {
                    this._dgRelated.ItemDataBound += handler;
                    this._dgRelated.DeleteCommand += handler2;
                }
            }
        }

        protected virtual UserControl labelCategory
        {
            get
            {
                return this._labelCategory;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._labelCategory = value;
            }
        }

        protected virtual Label lblAddOption
        {
            get
            {
                return this._lblAddOption;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblAddOption = value;
            }
        }

        protected virtual Label lblAddOptionValue
        {
            get
            {
                return this._lblAddOptionValue;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblAddOptionValue = value;
            }
        }

        protected virtual Label lblAll
        {
            get
            {
                return this._lblAll;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblAll = value;
            }
        }

        protected virtual Label lblCategories
        {
            get
            {
                return this._lblCategories;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblCategories = value;
            }
        }

        protected virtual Label lblDocuments
        {
            get
            {
                return this._lblDocuments;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblDocuments = value;
            }
        }

        protected virtual Label lblGeneral
        {
            get
            {
                return this._lblGeneral;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblGeneral = value;
            }
        }

        protected virtual Label lblImages
        {
            get
            {
                return this._lblImages;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblImages = value;
            }
        }

        protected virtual Label lblModels
        {
            get
            {
                return this._lblModels;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblModels = value;
            }
        }

        protected virtual Label lblOptions
        {
            get
            {
                return this._lblOptions;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblOptions = value;
            }
        }

        protected virtual Label lblRelatedProducts
        {
            get
            {
                return this._lblRelatedProducts;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblRelatedProducts = value;
            }
        }

        protected virtual Label lblSelectedOptionID
        {
            get
            {
                return this._lblSelectedOptionID;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._lblSelectedOptionID = value;
            }
        }

        protected virtual HtmlGenericControl optionvaluesdiv
        {
            get
            {
                return this._optionvaluesdiv;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._optionvaluesdiv = value;
            }
        }

        protected virtual PlaceHolder plhMsg
        {
            get
            {
                return this._plhMsg;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._plhMsg = value;
            }
        }

        protected virtual Panel pnlCategories
        {
            get
            {
                return this._pnlCategories;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlCategories = value;
            }
        }

        protected virtual Panel pnlDocCtrl
        {
            get
            {
                return this._pnlDocCtrl;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlDocCtrl = value;
            }
        }

        protected virtual Panel pnlImageCtrl
        {
            get
            {
                return this._pnlImageCtrl;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlImageCtrl = value;
            }
        }

        protected virtual Panel pnlLang
        {
            get
            {
                return this._pnlLang;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlLang = value;
            }
        }

        protected virtual Panel pnlList
        {
            get
            {
                return this._pnlList;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlList = value;
            }
        }

        protected virtual Panel pnlModel
        {
            get
            {
                return this._pnlModel;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlModel = value;
            }
        }

        protected virtual Panel pnlOptions
        {
            get
            {
                return this._pnlOptions;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlOptions = value;
            }
        }

        protected virtual Panel pnlProduct
        {
            get
            {
                return this._pnlProduct;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlProduct = value;
            }
        }

        protected virtual Panel pnlProductTabs
        {
            get
            {
                return this._pnlProductTabs;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlProductTabs = value;
            }
        }

        protected virtual Panel pnlRelated
        {
            get
            {
                return this._pnlRelated;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._pnlRelated = value;
            }
        }

        protected virtual AdminProductDetail productdetail
        {
            get
            {
                return this._productdetail;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._productdetail = value;
            }
        }

        protected virtual AdminProductDoc productdoc
        {
            get
            {
                return this._productdoc;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                AdminProductDoc.SelectDocEventHandler handler = new AdminProductDoc.SelectDocEventHandler(this.productdoc_SelectDoc);
                AdminProductDoc.SearchDocsEventHandler handler2 = new AdminProductDoc.SearchDocsEventHandler(this.productdoc_SearchDocs);
                AdminProductDoc.DeleteDocEventHandler handler3 = new AdminProductDoc.DeleteDocEventHandler(this.productdoc_DeleteDoc);
                AdminProductDoc.AddButtonEventHandler handler4 = new AdminProductDoc.AddButtonEventHandler(this.productdoc_AddButton);
                if (this._productdoc != null)
                {
                    this._productdoc.SelectDoc -= handler;
                    this._productdoc.SearchDocs -= handler2;
                    this._productdoc.DeleteDoc -= handler3;
                    this._productdoc.AddButton -= handler4;
                }
                this._productdoc = value;
                if (this._productdoc != null)
                {
                    this._productdoc.SelectDoc += handler;
                    this._productdoc.SearchDocs += handler2;
                    this._productdoc.DeleteDoc += handler3;
                    this._productdoc.AddButton += handler4;
                }
            }
        }

        protected virtual AdminProductImage productimage
        {
            get
            {
                return this._productimage;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                AdminProductImage.DeleteImageEventHandler handler = new AdminProductImage.DeleteImageEventHandler(this.productimage_DeleteImage);
                AdminProductImage.AddButtonEventHandler handler2 = new AdminProductImage.AddButtonEventHandler(this.productimage_AddButton);
                if (this._productimage != null)
                {
                    this._productimage.DeleteImage -= handler;
                    this._productimage.AddButton -= handler2;
                }
                this._productimage = value;
                if (this._productimage != null)
                {
                    this._productimage.DeleteImage += handler;
                    this._productimage.AddButton += handler2;
                }
            }
        }

        protected virtual AdminProductList productlist
        {
            get
            {
                return this._productlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                AdminProductList.ReturnButtonEventHandler handler = new AdminProductList.ReturnButtonEventHandler(this.productlist_ReturnButton);
                AdminProductList.ItemCommandEventHandler handler2 = new AdminProductList.ItemCommandEventHandler(this.productlist_ItemCommand);
                AdminProductList.EditCommandEventHandler handler3 = new AdminProductList.EditCommandEventHandler(this.productlist_EditCommand);
                AdminProductList.AddRelatedEventHandler handler4 = new AdminProductList.AddRelatedEventHandler(this.productlist_AddRelated);
                AdminProductList.AddButtonEventHandler handler5 = new AdminProductList.AddButtonEventHandler(this.productlist_AddButton);
                if (this._productlist != null)
                {
                    this._productlist.ReturnButton -= handler;
                    this._productlist.ItemCommand -= handler2;
                    this._productlist.EditCommand -= handler3;
                    this._productlist.AddRelated -= handler4;
                    this._productlist.AddButton -= handler5;
                }
                this._productlist = value;
                if (this._productlist != null)
                {
                    this._productlist.ReturnButton += handler;
                    this._productlist.ItemCommand += handler2;
                    this._productlist.EditCommand += handler3;
                    this._productlist.AddRelated += handler4;
                    this._productlist.AddButton += handler5;
                }
            }
        }

        protected virtual PlaceHolder phPadding
        {
            get
            {
                return this._phPadding;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._phPadding = value;
            }
        }

        protected virtual SelectLang selectlang
        {
            get
            {
                return this._selectlang;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                SelectLang.BeforeChangeEventHandler handler = new SelectLang.BeforeChangeEventHandler(this.selectlang_BeforeChange);
                SelectLang.AfterChangeEventHandler handler2 = new SelectLang.AfterChangeEventHandler(this.selectlang_AfterChange);
                if (this._selectlang != null)
                {
                    this._selectlang.BeforeChange -= handler;
                    this._selectlang.AfterChange -= handler2;
                }
                this._selectlang = value;
                if (this._selectlang != null)
                {
                    this._selectlang.BeforeChange += handler;
                    this._selectlang.AfterChange += handler2;
                }
            }
        }

        protected virtual HtmlGenericControl tabs
        {
            get
            {
                return this._tabs;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._tabs = value;
            }
        }

        protected virtual HtmlTable tbloptions
        {
            get
            {
                return this._tbloptions;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._tbloptions = value;
            }
        }

        protected virtual TextBox txtAddModels
        {
            get
            {
                return this._txtAddModels;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtAddModels = value;
            }
        }

        protected virtual TextBox txtAddOption
        {
            get
            {
                return this._txtAddOption;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtAddOption = value;
            }
        }

        protected virtual TextBox txtAddOptionValue
        {
            get
            {
                return this._txtAddOptionValue;
            }
            [MethodImpl(MethodImplOptions.Synchronized)]
            set
            {
                this._txtAddOptionValue = value;
            }
        }
    }
}

